﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:p="clr-namespace:Bugger.Presentation.Properties"
             xmlns:dd="clr-namespace:Bugger.Presentation.DesignData"
             xmlns:c="clr-namespace:Bugger.Presentation.Converters"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             x:Class="Bugger.Presentation.Views.TeamBugsView" 
             mc:Ignorable="d" d:DataContext="{d:DesignInstance {x:Type dd:SampleTeamBugsViewModel}, IsDesignTimeCreatable=True}"
             d:Height="600" d:Width="400">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBlock Margin="5,0" Text="{x:Static p:Resources.TeamBugs}" VerticalAlignment="Bottom"/>
        <DataGrid ItemsSource="{Binding Bugs}" FrozenColumnCount="2" Margin="5" Grid.Row="1" AutoGenerateColumns="False" IsReadOnly="True">
            <DataGrid.Columns>
                <DataGridTemplateColumn Width="SizeToCells">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image HorizontalAlignment="Center" Height="16" Width="16" VerticalAlignment="Center" Source="{Binding Type, Converter={x:Static c:BugTypeToImageConverter.Default}}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="{x:Static p:Resources.BugID}" Binding="{Binding ID}"/>
                <DataGridTextColumn Header="{x:Static p:Resources.BugPriority}" Binding="{Binding Priority}"/>
                <DataGridTextColumn Header="{x:Static p:Resources.BugSeverity}" Binding="{Binding Severity}"/>
                <DataGridTextColumn Header="{x:Static p:Resources.BugState}" Binding="{Binding State}"/>
                <DataGridTextColumn Header="{x:Static p:Resources.BugAssignedTo}" Binding="{Binding AssignedTo}"/>
                <DataGridTextColumn Header="{x:Static p:Resources.BugTitle}" Binding="{Binding Title}" Width="*"/>
            </DataGrid.Columns>
            <DataGrid.RowDetailsTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="2*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="2*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="{x:Static p:Resources.BugCreatedBy}" FontWeight="Bold"/>
                        <TextBlock Grid.Column="1" Text="{Binding CreatedBy}" Margin="5,0"/>
                        <TextBlock Grid.Column="2" Text="{x:Static p:Resources.BugChangedDate}" FontWeight="Bold"/>
                        <TextBlock Grid.Column="3" Text="{Binding ChangedDate}" Margin="5,0"/>
                        <TextBlock Grid.Row="1" Text="{x:Static p:Resources.BugDescription}" FontWeight="Bold"/>
                        <TextBlock Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Description}" TextWrapping="Wrap" Margin="5,0"/>
                    </Grid>
                </DataTemplate>
            </DataGrid.RowDetailsTemplate>
        </DataGrid>
    </Grid>
</UserControl>
